﻿<%@ Page Language="C#" MasterPageFile="~/Templates/Admin.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="Admin_User_Default" Title="Untitled Page" %>
<%@ Register Assembly="Jalal.Library" Namespace="Jalal.Library.Web.Control" TagPrefix="ucc" %>
<%@ Register Src="~/Controls/wucEmptyGridMessage.ascx" TagName="EmptyGridMessage" TagPrefix="wuc" %>
<%@ Register Src="~/Controls/wucDatePicker.ascx" TagName="DatePicker" TagPrefix="wuc" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <script src="<%= siteRoot %>Javascripts/Common/ApplicationCommon.js" type="text/javascript"></script>
</asp:Content>
<asp:Content ID="MiddleAreaContent" ContentPlaceHolderID="MiddleArea" Runat="Server">
    <table width="100%" cellpadding="10" border="0" cellspacing="10" class="table_area">
        <tr>
            <td class="heading-text">
                Site Users
            </td>
        </tr>
        <tr>
            <td>
                <ucc:ResponseMessage ID="uccResponse" runat="server"></ucc:ResponseMessage>
            </td>
        </tr>
        <tr>
            <td>
                <table class="search-box">
                    <tr>
                        <td>
                            <table cellpadding="5" cellspacing="5">
                                <tr align="left">
                                    <td>Username <asp:TextBox ID="tbxUsername" runat="server"></asp:TextBox></td>
                                    <td class="gap">&nbsp;</td>
                                    <td>Role <asp:DropDownList ID="ddlRole" runat="server"></asp:DropDownList></td>
                                    <td class="gap">&nbsp;</td>
                                    <td>Active
                                        <asp:DropDownList ID="ddlActive" runat="server">
                                            <asp:ListItem Text="All" Value="-1"></asp:ListItem>
                                            <asp:ListItem Text="Active" Value="True"></asp:ListItem>
                                            <asp:ListItem Text="Inactive" Value="False"></asp:ListItem>
                                        </asp:DropDownList>
                                    </td>
                                    <td class="gap">&nbsp;</td>
                                    <td>Locked
                                        <asp:DropDownList ID="ddlLocked" runat="server">
                                            <asp:ListItem Text="All" Value="-1"></asp:ListItem>
                                            <asp:ListItem Text="Locked" Value="True"></asp:ListItem>
                                            <asp:ListItem Text="Not locked" Value="False"></asp:ListItem>
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td>
                            <table cellpadding="5" cellspacing="5">
                                <tr align="left">
                                    <td>Register Date From</td>
                                    <td><wuc:DatePicker ID="regDateFrom" runat="server" YearFrom="2009" YearTo="2020" /></td>
                                    <td class="gap">&nbsp;</td>
                                    <td>Register Date To</td>
                                    <td><wuc:DatePicker ID="regDateTo" runat="server" YearFrom="2009" YearTo="2020" /></td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td align="right">
                            <asp:Button ID="btnSearch" runat="server" Text="Search" CssClass="button" OnClick="Search_Click" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td align="right">
                <table>
                    <tr>
                        <td>
                            <asp:Button ID="btnUpdateLock" runat="server" Text="Update Lock" 
                                OnClick="UpdateLock_Click" CssClass="button" />
                        </td>
                        <td>
                            <asp:Button ID="btnDelete" runat="server" Text="Delete" 
                                OnClick="Delete_Click" CssClass="button" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
        <tr>
            <td>
                <asp:GridView ID="grvUsers" runat="server" AutoGenerateColumns="false" PageSize="20" AllowPaging="false"
                    AllowSorting="false" OnRowDataBound="Grid_RowDataBound" HeaderStyle-Font-Bold="true" 
                    Width="100%" AlternatingRowStyle-BackColor="#F5F5F5" CellPadding="5" CellSpacing="0"  >
                    <Columns>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                <table>
                                    <tr>
                                        <td rowspan="2" valign="middle">
                                            #</td>
                                        <td>
                                            <ucc:SortButton IsSortUpButton="true" runat="server"
                                                OnCommand="Grid_Sort" CommandName="Sort" CommandArgument="UserId" /></td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <ucc:SortButton IsSortUpButton="false" runat="server"
                                                OnCommand="Grid_Sort" CommandName="Sort" CommandArgument="UserId Desc" /></td>
                                    </tr>
                                </table>
                            </HeaderTemplate>
                            <ItemStyle HorizontalAlign="Center" />
                            <ItemTemplate>
                                <asp:Label ID="lblId" runat="server" Text='<%# Eval("Id") %>'></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                <table>
                                    <tr>
                                        <td rowspan="2" valign="middle">
                                            Username</td>
                                        <td>
                                            <ucc:SortButton IsSortUpButton="true" runat="server"
                                                OnCommand="Grid_Sort" CommandName="Sort" CommandArgument="SiteUserName" /></td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <ucc:SortButton IsSortUpButton="false" runat="server"
                                                OnCommand="Grid_Sort" CommandName="Sort" CommandArgument="SiteUserName Desc" /></td>
                                    </tr>
                                </table>
                            </HeaderTemplate>
                            <ItemStyle HorizontalAlign="Center" />
                            <ItemTemplate>
                                <asp:HyperLink ID="hlkUsername" runat="server" Text='<%# Eval("Username") %>'></asp:HyperLink>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                <table>
                                    <tr>
                                        <td rowspan="2" valign="middle">
                                            Email</td>
                                        <td>
                                            <ucc:SortButton IsSortUpButton="true" runat="server"
                                                OnCommand="Grid_Sort" CommandName="Sort" CommandArgument="Email" /></td>
                                    </tr>
                                    <tr>
                                        <td>
                                            <ucc:SortButton IsSortUpButton="false" runat="server"
                                                OnCommand="Grid_Sort" CommandName="Sort" CommandArgument="Email Desc" /></td>
                                    </tr>
                                </table>
                            </HeaderTemplate>
                            <ItemStyle HorizontalAlign="Center" />
                            <ItemTemplate>
                                <asp:HyperLink ID="hlkEmail" runat="server" Text='<%# Eval("Email") %>' Target="_blank"></asp:HyperLink>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="CreateDateTime"
                            HeaderText="Registered" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:dd/MM/yyyy}" /> 
                        <asp:BoundField DataField="InvalidLoginCount" HeaderText="Failed login" ItemStyle-HorizontalAlign="Center" />
                        <asp:TemplateField>
                            <HeaderTemplate>
                                Activated
                            </HeaderTemplate>
                            <ItemStyle HorizontalAlign="Center" />
                            <ItemTemplate>
                                <asp:Label ID="lblActivated" runat="server" ></asp:Label>
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                Locked
                            </HeaderTemplate>
                            <ItemStyle HorizontalAlign="Center" />
                            <ItemTemplate>
                                <asp:CheckBox ID="cbxLocked" runat="server" Checked='<%# Eval("IsLocked") %>' />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:TemplateField>
                            <HeaderTemplate>
                                <asp:CheckBox ID="cbxSelectAll" runat="server" />
                            </HeaderTemplate>
                            <ItemStyle HorizontalAlign="Center" />
                            <ItemTemplate>
                                <asp:CheckBox ID="cbxSelect" runat="server" />
                            </ItemTemplate>
                        </asp:TemplateField>
                    </Columns>
                    <EmptyDataTemplate>
                        <wuc:EmptyGridMessage ID="EmptyGridMessage1" runat="server" MessageText="There is no record" />
                    </EmptyDataTemplate>
                </asp:GridView>
            </td>
        </tr>
        <tr>
            <td align="center">
                <asp:Repeater ID="rptPager" runat="server" OnItemDataBound="Pager_DataBound">
                    <ItemTemplate>
                        <asp:LinkButton ID="lkbPageIndex" runat="server" CssClass="page-index" 
                            Text='<%# Container.DataItem.ToString() %>' CommandName="PagingCommand"
                            CommandArgument='<%# Container.DataItem %>'
                            OnCommand="Page_Change"></asp:LinkButton>
                    </ItemTemplate>
                </asp:Repeater>
            </td>
        </tr>
        <tr>
            <td align="left">
                <table>
                    <tr>
                        <td>
                            <asp:Button ID="btnUpdateLock2" runat="server" Text="Update Lock" 
                                OnClick="UpdateLock_Click" CssClass="button" />
                        </td>
                        <td>
                            <asp:Button ID="btnDelete2" runat="server" Text="Delete" 
                                OnClick="Delete_Click" CssClass="button" />
                        </td>
                    </tr>
                </table>
            </td>
        </tr>
    </table>
</asp:Content>

